package org.jplcc.memory;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Logger;

import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;

import org.jplcc.JPLCCException;

public class MemoryMap {

	private String plcName;
	private Map<String, Object> map;

	MemoryMap(String plcName) {		
		this.plcName= plcName; 
		map = Collections.synchronizedMap(new HashMap<String, Object>());
	}

	public Object get(String key) throws JPLCCException {
		Object object = map.get(key);
		if (object == null) {
			throw new JPLCCException("Invalid tag: " + key);
		}

		return object;
	}

	public Object put(String key, Object value) {
		Object returnValue = map.put(key, value);
		return returnValue;
	}
}
